import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes_xy = [
  {
    path: '/',
    name: 'Test',
    component: () => import('@/views/test')
  }
]

const router = new VueRouter({
  routes: routes_xy,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {  // 返回页面记录浏览位置
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  }
})

export default router
